Specifying Port Names and Location Names
Specifying Port Names and Location Names
Before initiating a session, you must open a port to communicate with other
programs. A port name and location name identify each port. An application can
open as many ports as it requires as long as each port name is unique within a
particular computer. You specify both the port name and the location name in
the PPC parameter block.
The next figure illustrates a single Macintosh computer with two
applications, and their corresponding port names and location names.
To open a port, you need to specify a port name. A port name consists of a
name string, a type string, and a script code for localization. For example, you
can designate "make memo" as the application's name string, "word processor
as its type string, and "smRoman" as its script code.
A port name is defined by a PPC port record. The PPC port record contains a
script code, name string, port kind selector, and type string. The
script code is an integer script identifier used for localization. The name
string consists of a 32-byte character string that designates the application
name. You should keep both the script code and the name string in a resource.
The port kind selector is an integer that selects the kind of type string. You
should make it consistent internationally. The type string can be either a
32-byte character string or a 4-character creator and a 4- character
application type. See Finder Interface for information on creators and file
types. See Worldwide Software Overview for information on
script codes and localization.
Two Macintosh applications and their corresponding ports
The PPCPortRec data type defines the PPC port record.
The location name identifies the location of the computer on the network. The
PPC Toolbox provides the location name when the user starts up the
computer. The location name is specified in the standard Name-Binding
Protocol (NBP) form, <object string>:PPCToolBox @<AppleTalk zone>. The
object string is the name provided in the Sharing Setup control panel in the
Control Panels folder. By default, the type string is "PPCToolBox". The
AppleTalk zone is the zone to which the particular Macintosh computer
belongs. For example, "Jane Doe's Macintosh:PPCToolBox@twilight" specifies
the object string, type string, and AppleTalk zone for a particular computer.
The LocationNameRec data type defines the location name record. The
locationKindSelector field can be set to ppcNoLocation, ppcNBPLocation, or
ppcNBPTypeLocation.
The ppcNoLocation constant is used when the location received from or passed
to a PPC Toolbox function is the location of the local machine.
Note: You should assign an NBP value directly-do not pack it using
nbpSetEntity.
The ppcNBPTypeLocation constant is used only by the PPCOpen function
when an alias location name is needed.
The NBP type to be used for the alias location name is passed in the
nbpType field of the location name record. Alias location names allow you to
filter the NBP objects (Macintosh computers) displayed by the program
linking dialog box using the PPCBrowser function.
An alias location name could be used to advertise a service (such as a
dictionary service) that is available to any application located on the network.
For example, "Joe Smith's Macintosh: dictionary@ozone" specifies the object
string, type string, and AppleTalk zone for a particular dictionary service.
To search for all dictionary services available within a zone, you use the
PPCBrowser function and a filter.